<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateShopDataFaqTable extends Migrator
{
    /**
     * Migrate Up.
     */
    public function up()
    {
        $table = $this->table('shop_data_faq', ['comment' => '常见问题', 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci']);
        $table->addColumn('title', 'string', ['limit'  =>  255, 'comment' => '问题'])
            ->addColumn('content', 'text', ['comment' => '内容'])
            ->addColumn(Column::enum('status', ['normal', 'hidden'])->setDefault('normal')->setComment('状态:normal=显示,hidden=隐藏'))
            ->addColumn('create_time', 'integer', ['limit'  =>  10, 'null' => true, 'default' => null, 'comment' => '创建时间'])
            ->addColumn('update_time', 'integer', ['limit'  => 10, 'null' => true, 'default' => null, 'comment' => '更新时间'])
            ->create();
    }

    /**
     * Migrate Down.
     */
    public function down()
    {
        $table = $this->table('shop_data_faq');
        $table->drop();
    }
}